<?php
/**
 * 菜洞众筹控制
 * User:LLW
 * Date:2020-04-07
 * Time:15:38
 */

namespace app\caidongweb\controller;

use app\caidongweb\model\RaiseModel;
use app\caidongweb\model\RaiseUserModel;
use think\Request;

class Raise extends BaseController
{
    //初始化程序
    public function __construct(Request $request)
    {
        parent::__construct();
        $this->raise = new RaiseModel();
        $this->raiuse = new RaiseUserModel();
    }


    /******************************** 众筹期数 ***************************************/
    /**
     * 众筹首页
     * @return \think\response\View
     */
    public function RaiseList()
    {
        $list = $this->raise->getList();
        $this->assign('list',$list);
        $this->assign('page',$list->render());
        return view();
    }

    /**
     * 发布
     * @return array|\think\response\View
     */
    public function RaiseAdd()
    {
        if(input('post.')){
            $res = $this->raise->postAdd();
            return $res;
        }
        return view();
    }

    /**
     * 结束排期
     * @return array
     */
    public function RaiseForce()
    {
        $res = $this->raise->getForce();
        return $res;
    }


    /******************************** 参与用户 ***************************************/

    /**
     * 首页
     * @return \think\response\View
     */
    public function RaiseUser()
    {
        $list = $this->raiuse->getList();
        $this->assign('list',$list);
        $this->assign('page',$list->render());
        return view();
    }
}